-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce line width to be at least 1px after applied transform #12812
Conversation
calixteman
commented
Jan 4, 2021
•
edited
Loading
edited
- add a comment to explain how minimal linewidth is computed.
- when context.linewidth < 1 after transform, firefox and chrome don't render in the same way (issue Rendering Issue in Chrome: Lose some green dots in rendering one PDF exported from AutoCAD #12810).
- set lineWidth to 1 after transform and before stroking
- aims fix issue Line drawing (Page 16) does not have the correct line thickness when using the demo application on Google Chrome or any brower #12295
- a pixel can be transformed into a rectangle with both heights < 1. A single rescale leads to a rectangle with dim equals to 1 and the other to something greater than 1.
- change the way to render rectangle with null dimensions:
- right now we rely on the lineWidth set before "re" but it can be set after "re" and before "S" and in this case the rendering will be wrong.
- render such rectangles as a single line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides some inline comment; can we add a reference-test for this?
src/display/canvas.js
Outdated
// Heuristic value used when enforcing minimum line widths. | ||
const MIN_WIDTH_FACTOR = 0.65; | ||
// Enforce line to have a minimal width of 1px when transform is applied | ||
const MIN_WIDTH_FACTOR = 1.000001; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, given all the different getSinglePixelWidth
and MIN_WIDTH_FACTOR
usages throughout this file; are these changes generally correct/safe (as in not regressing existing tests)?
Unfortunately PR #4615 landed without a test-case included, so please also manually test the issues/bugs listed there to ensure that you're not regressing anything here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked all the pdf mentioned in the above PR and they all looks good.
I ran locally ref tests and the differences are minimal.
I'd say that with my eyes the rendering on firefox-linux and on acrobat-windows are very close (same screen).
Does this PR improve also the rendering of issue #12295? The problems in that issue are caused by the existing implementation of |
* add a comment to explain how minimal linewidth is computed. * when context.linewidth < 1 after transform, firefox and chrome don't render in the same way (issue mozilla#12810). * set lineWidth to 1 after transform and before stroking - aims fix issue mozilla#12295 - a pixel can be transformed into a rectangle with both heights < 1. A single rescale leads to a rectangle with dim equals to 1 and the other to something greater than 1. * change the way to render rectangle with null dimensions: - right now we rely on the lineWidth set before "re" but it can be set after "re" and before "S" and in this case the rendering will be wrong. - render such rectangles as a single line.
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.67.70.0:8877/dcbfeb0b8d4948f/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://3.101.106.178:8877/3d6d8cec570cfc5/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/dcbfeb0b8d4948f/output.txt Total script time: 21.59 mins
Image differences available at: http://54.67.70.0:8877/dcbfeb0b8d4948f/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://3.101.106.178:8877/3d6d8cec570cfc5/output.txt Total script time: 27.14 mins
Image differences available at: http://3.101.106.178:8877/3d6d8cec570cfc5/reftest-analyzer.html#web=eq.log |
/botio makeref |
From: Bot.io (Linux m4)ReceivedCommand cmd_makeref from @brendandahl received. Current queue size: 0 Live output at: http://54.67.70.0:8877/3f829b52819efd4/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @brendandahl received. Current queue size: 0 Live output at: http://3.101.106.178:8877/106cd75734b80c5/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/3f829b52819efd4/output.txt Total script time: 24.82 mins
|
From: Bot.io (Windows)SuccessFull output at http://3.101.106.178:8877/106cd75734b80c5/output.txt Total script time: 26.49 mins
|